﻿using UnityEngine;

//------------------------------------------------------------
// shaco Framework
// Copyright © 2017-2025 chang.liu All rights reserved.
// Feedback: 449612236@qq.com
//------------------------------------------------------------

namespace shaco
{
    public class GizmosHelper
    {
        public Color boundsColor = Color.cyan;

        static public void DrawBounds(OrientedBounds bounds)
        {
            Matrix4x4 originalMatrix = Gizmos.matrix;
            Gizmos.matrix = Matrix4x4.TRS(bounds.center, bounds.rotation, bounds.size);
            Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
            Gizmos.matrix = originalMatrix;
        }

        static public void DrawBounds(Renderer renderer)
        {
            Bounds bounds = renderer.localBounds;
            Matrix4x4 originalMatrix = Gizmos.matrix;
            Gizmos.matrix = renderer.transform.localToWorldMatrix;
            Gizmos.DrawWireCube(bounds.center, bounds.size);
            Gizmos.matrix = originalMatrix;
        }

        static public void DrawBoxCollider(BoxCollider collider)
        {
            Matrix4x4 originalMatrix = Gizmos.matrix;
            Gizmos.matrix = Matrix4x4.TRS(collider.transform.TransformPoint(collider.center), collider.transform.rotation, collider.transform.lossyScale);
            Gizmos.DrawWireCube(Vector3.zero, collider.size);
            Gizmos.matrix = originalMatrix;
        }
    }
}